﻿using MediatR;
using W.Purchase.Domain;
using W.Purchase.Read.API.AppLication.Command.PayableCommand;
using W.Purchase.Repository.Impl;
using W.Purchase.Repository.Interface;

namespace W.Purchase.Read.API.AppLication.CommandHandler.PayableCommandHandler
{
    public class PayableModelCommandHandler:IRequestHandler<PayableModelCommand,Payable>
    {
        private readonly IPayableRepository _ipayableRepository;
        public PayableModelCommandHandler(IPayableRepository ipayableRepository)
        {
            _ipayableRepository = ipayableRepository;
        }

        public async Task<Payable> Handle(PayableModelCommand request, CancellationToken cancellationToken)
        {
            var list = await _ipayableRepository.GetModelAsync(request.PayableId);
            return list;
        }
    }
}
